package br.com.universidade.servlets;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;

public class GenericServlet extends HttpServlet{
	protected static final String JSP_CADASTR_PROFESSOR = "/PAGES/professor/formProfessor.jsp";
	protected static final String  JSP_LISTAR_PROFESSOR= "/PAGES/professor/listarProfessor.jsp";
	protected static final String ACTION_FORM= "action";
	private static final String MSG="msg";
	
	public void saveSucessMessage(HttpServletRequest request){
		request.setAttribute(MSG, "Operacao realizada com sucesso");
	}
	
	public void saveErrorMessage(HttpServletRequest request){
		request.setAttribute(MSG, "Erro ao realizar operacao");
	}

	public static boolean isFilled(String campo){
		if(campo==null || campo.trim().isEmpty()){
			return true;
		}
		return false;
	}
	
	public static boolean isInteger(String campo){
		try{
			Integer.parseInt(campo);
			return true;
		}catch (Exception e) {
			return false;
		}
		
		
	}
}
